using SimpleJSON;
using UnityEngine.UI;

namespace Gj
{
    public class TipsItemHelp : NodeHelper
    {
        [SelectRef(UIKey.LOCAL_KEY)] public string localTitle;
        [SelectRef(UIKey.LOCAL_KEY)] public string localDesc;

        protected override BindDataType bindDataType => BindDataType.All;

        // Use this for initialization
        protected override void Start()
        {
            base.Start();
            UnityTools.GetComponentRequire<Button>(gameObject).onClick.AddListener(Show);
        }

        private void Show()
        {
            var tipsData = new JSONObject();
            if (!StringTools.IsEmpty(localTitle)) tipsData["title"] = Localization.Instance.GetLocalValue(localTitle);
            if (!StringTools.IsEmpty(localDesc)) tipsData["desc"] = Localization.Instance.GetLocalValue(localDesc);
            Change(tipsData);
        }
    }
}